package com.example.chatrecommendation.controller;

import com.example.chatrecommendation.service.impl.AiPaintingServiceImpl;
import com.example.chatrecommendation.tool.R;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiModelProperty;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.net.MalformedURLException;

@Slf4j
@RestController
@RequestMapping("/student")
@Api("SD图生图模块")
public class AiPaintingController {
    @Autowired
    private AiPaintingServiceImpl sdSerImpl;
    @PostMapping("/getHonor")
    @ApiModelProperty("获取荣誉徽章")
    public R<String> getHonor() {
        log.info("honor:");
        return R.success(sdSerImpl.generateHonorBadge());
    }

    @PostMapping("/getImage")
    @ApiModelProperty("获取图片")
    public R<String> getImage(@RequestBody String prompt) throws MalformedURLException {
        log.info("prompt:{}",prompt);
        return R.success(sdSerImpl.generateImage(prompt));
    }
}
